<html>
<head><meta charset="utf-8"><title>design meeting 2019.11.04 · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html">design meeting 2019.11.04</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="179863691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179863691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179863691">(Nov 04 2019 at 19:03)</a>:</h4>
<p>Hi <span class="user-group-mention" data-user-group-id="692">@WG-traits</span></p>



<a name="179863924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179863924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179863924">(Nov 04 2019 at 19:05)</a>:</h4>
<p>So I think we were going to talk about regions, universes, etc</p>



<a name="179863931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179863931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179863931">(Nov 04 2019 at 19:05)</a>:</h4>
<p>At least that's where we left it last time</p>



<a name="179863979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179863979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179863979">(Nov 04 2019 at 19:05)</a>:</h4>
<p>I'm trying to decide the best "starting point"</p>



<a name="179864055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864055">(Nov 04 2019 at 19:06)</a>:</h4>
<p>So last time we were talking about normalization under binders</p>



<a name="179864091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864091">(Nov 04 2019 at 19:07)</a>:</h4>
<p>Meaning when you have something like <code>for&lt;'a&gt; fn(&lt;&amp;'a () as Foo&gt;::Bar)</code></p>



<a name="179864171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864171">(Nov 04 2019 at 19:07)</a>:</h4>
<p>Right now, rustc has some difficulty with this</p>



<a name="179864270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864270">(Nov 04 2019 at 19:08)</a>:</h4>
<p>let me back up :)</p>



<a name="179864295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864295">(Nov 04 2019 at 19:09)</a>:</h4>
<p>If we have a type like <code>&lt;T as Iterator&gt;::Item</code></p>



<a name="179864302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864302">(Nov 04 2019 at 19:09)</a>:</h4>
<p>and we try to normalize it</p>



<a name="179864314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Keith Yeung <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864314">(Nov 04 2019 at 19:09)</a>:</h4>
<p>what does "normalize" mean?</p>



<a name="179864334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864334">(Nov 04 2019 at 19:09)</a>:</h4>
<p>try to find an applicable impl and substitute the value from that impl</p>



<a name="179864337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864337">(Nov 04 2019 at 19:09)</a>:</h4>
<p>so e.g. if you have</p>



<a name="179864395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864395">(Nov 04 2019 at 19:10)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">Iterator</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">vec</span>::<span class="n">IntoIter</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">type</span> <span class="nc">Item</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="179864423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864423">(Nov 04 2019 at 19:10)</a>:</h4>
<p>and then we have <code>&lt;vec::IntoIter&lt;Foo&gt; as Iterator&gt;::Item</code></p>



<a name="179864427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864427">(Nov 04 2019 at 19:10)</a>:</h4>
<p>we could normalize that to <code>Foo</code></p>



<a name="179864480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864480">(Nov 04 2019 at 19:11)</a>:</h4>
<p>the way rustc works today, we have a phase where we look for associated type projections of this kind and we replace them --</p>



<a name="179864484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864484">(Nov 04 2019 at 19:11)</a>:</h4>
<p>this is called "normalizing"</p>



<a name="179864576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864576">(Nov 04 2019 at 19:12)</a>:</h4>
<p>to be clear, I am talking specifically about rustc right now</p>



<a name="179864587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864587">(Nov 04 2019 at 19:12)</a>:</h4>
<p>chalk has a slightly different approach, though it still involves a concept of normalizing</p>



<a name="179864803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864803">(Nov 04 2019 at 19:13)</a>:</h4>
<p>we call this "eager normalization" because, in rustc, we have to do it whenever we bring types "into scope" -- this context of "into scope" is not very clear, I realize, I'm not sure the best way to describe it.</p>



<a name="179864830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864830">(Nov 04 2019 at 19:13)</a>:</h4>
<p>An example would be: if you are type-checking, and you see an expression like <code>foo.bar</code>, where </p>
<div class="codehilite"><pre><span></span><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">Iterator</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">bar</span>: <span class="o">&lt;</span><span class="n">T</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nb">Iterator</span><span class="o">&gt;</span>::<span class="n">Item</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="179864850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864850">(Nov 04 2019 at 19:13)</a>:</h4>
<p>we would load the type for the field <code>bar</code> we will get <code>&lt;T as Iterator&gt;::Item</code></p>



<a name="179864901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864901">(Nov 04 2019 at 19:14)</a>:</h4>
<p>this type is not "in scope", it is taken from the struct -- we have to do substitutions to bring it "into scope" in the sense I mean</p>



<a name="179864960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864960">(Nov 04 2019 at 19:15)</a>:</h4>
<p>so e.g. if the type of <code>foo</code> is <code>Foo&lt;vec::IntoIter&lt;u32&gt;&gt;</code></p>



<a name="179864984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864984">(Nov 04 2019 at 19:15)</a>:</h4>
<p>we would substitute and get that the type of <code>bar</code> is <code>&lt;vec::IntoIter&lt;u32&gt; as Iterator&gt;::Item</code> --</p>



<a name="179864993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864993">(Nov 04 2019 at 19:15)</a>:</h4>
<p>and then we have to normalize</p>



<a name="179864996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179864996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179864996">(Nov 04 2019 at 19:15)</a>:</h4>
<p>which would yield <code>u32</code></p>



<a name="179865003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865003">(Nov 04 2019 at 19:15)</a>:</h4>
<p>the point of <em>eager</em> normalization is that we have to do that before we go and compare types</p>



<a name="179865062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865062">(Nov 04 2019 at 19:16)</a>:</h4>
<p>that simplifies the logic that compares types</p>



<a name="179865066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865066">(Nov 04 2019 at 19:16)</a>:</h4>
<p>Right, so rustc normalizes as soon as it uses the type outside of the original context</p>



<a name="179865070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865070">(Nov 04 2019 at 19:16)</a>:</h4>
<p>yeah</p>



<a name="179865076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865076">(Nov 04 2019 at 19:16)</a>:</h4>
<p>but that can be tricky</p>



<a name="179865080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865080">(Nov 04 2019 at 19:16)</a>:</h4>
<p>for one thing, it's easy to forget</p>



<a name="179865097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865097">(Nov 04 2019 at 19:16)</a>:</h4>
<p>for another, sometimes there are times when you are kind of "mixing" things that are normalized and things that are not</p>



<a name="179865119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865119">(Nov 04 2019 at 19:17)</a>:</h4>
<p>that doesn't really matter, since normalizing twice doesn't hurt</p>



<a name="179865125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865125">(Nov 04 2019 at 19:17)</a>:</h4>
<p>but it can just make it hard to remember and it feels inefficient</p>



<a name="179865132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865132">(Nov 04 2019 at 19:17)</a>:</h4>
<p>even in our example above,</p>



<a name="179865154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865154">(Nov 04 2019 at 19:17)</a>:</h4>
<p>if the type of the local variable <code>foo</code> is "in scope", it must also be fully normalized</p>



<a name="179865159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865159">(Nov 04 2019 at 19:17)</a>:</h4>
<p>so the type <code>vec::IntoIter&lt;u32&gt;</code> that we substituted in is already normalized</p>



<a name="179865171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865171">(Nov 04 2019 at 19:17)</a>:</h4>
<p>and we then <em>renormalize</em> it, in a sense</p>



<a name="179865221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865221">(Nov 04 2019 at 19:18)</a>:</h4>
<p>but anyway the bigger problem is</p>



<a name="179865279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865279">(Nov 04 2019 at 19:19)</a>:</h4>
<p>when you have types like this one <code>for&lt;'a&gt; fn(&lt;&amp;'a () as Foo&gt;::Bar)</code>, we need to normalize "inside" the <code>for</code> binder</p>



<a name="179865292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865292">(Nov 04 2019 at 19:19)</a>:</h4>
<p>sometimes normalization doesn't complete right away, for example if there are inference variables</p>



<a name="179865314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865314">(Nov 04 2019 at 19:19)</a>:</h4>
<p>so e.g. in an extreme case if you have <code>&lt;?X as Iterator&gt;::Item</code>, we can't normalize it yet -- we don't know what impl it will be</p>



<a name="179865374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865374">(Nov 04 2019 at 19:20)</a>:</h4>
<p>the way we handle that today is that we create an inference variable to represent the result (<code>?R</code>) and then we add a pending obligation that says <code>Normalize(&lt;?X as Iterator&gt;::Item -&gt; ?R)</code>, essentially, to use a chalk-like notation</p>



<a name="179865445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865445">(Nov 04 2019 at 19:20)</a>:</h4>
<p>but if we get stuck in this position inside of the <code>for&lt;'a&gt;</code> binder, we are in a bad spot. We don't currently have a way to create inference variables that can "equal" a higher-ranked region like <code>'a</code></p>



<a name="179865459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865459">(Nov 04 2019 at 19:21)</a>:</h4>
<p>universes basically gives us a mechanism for doing this</p>



<a name="179865486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865486">(Nov 04 2019 at 19:21)</a>:</h4>
<p>(does this make sense so far?)</p>



<a name="179865512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865512">(Nov 04 2019 at 19:21)</a>:</h4>
<blockquote>
<p>but if we get stuck in this position inside of the <code>for&lt;'a&gt;</code> binder, we are in a bad spot. We don't currently have a way to create inference variables that can "equal" a higher-ranked region like <code>'a</code></p>
</blockquote>
<p>(I imagine it might not be clear <em>why</em> we can't do this yet...)</p>



<a name="179865573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865573">(Nov 04 2019 at 19:22)</a>:</h4>
<p>You say "equal" a higher-ranked region, but isn't it like nesting scopes?</p>



<a name="179865596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865596">(Nov 04 2019 at 19:22)</a>:</h4>
<p>yeah, so that's part of it:</p>



<a name="179865611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865611">(Nov 04 2019 at 19:22)</a>:</h4>
<p>like if we are going to eagerly normalize</p>



<a name="179865621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865621">(Nov 04 2019 at 19:22)</a>:</h4>
<p>we have to be able to produce a result</p>



<a name="179865652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865652">(Nov 04 2019 at 19:23)</a>:</h4>
<p>so we might need to transform <code>for&lt;'a&gt; fn(&lt;vec::IntoIter&lt;&amp;'a u32&gt; as Iterator&gt;::Item)</code></p>



<a name="179865658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865658">(Nov 04 2019 at 19:23)</a>:</h4>
<p>to <code>for&lt;'a&gt; fn(&amp;'a u32)</code></p>



<a name="179865700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865700">(Nov 04 2019 at 19:23)</a>:</h4>
<p>anyway, the way lazy norm works is rather different</p>



<a name="179865774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865774">(Nov 04 2019 at 19:24)</a>:</h4>
<p>we wait until we are trying to equate two types (say, <code>&lt;vec::IntoIter&lt;u32&gt; as Iterator&gt;::Item</code> and <code>u32</code>)</p>



<a name="179865785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865785">(Nov 04 2019 at 19:24)</a>:</h4>
<p>and then we try to prove that this normalization works</p>



<a name="179865837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865837">(Nov 04 2019 at 19:24)</a>:</h4>
<p>so in some sense whereas before we had a function <code>Normalize(T) -&gt; U</code> that (eagerly) normalized a type <code>T</code> to some type <code>U</code>, and that function had to recursively process everything</p>



<a name="179865867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865867">(Nov 04 2019 at 19:25)</a>:</h4>
<p>now our base operation is instead <code>Equal(T, U)</code> that proves two types are equal -- and it might do that by normalizing</p>



<a name="179865970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865970">(Nov 04 2019 at 19:26)</a>:</h4>
<p>this matters because it means that we enter new scopes</p>



<a name="179865974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865974">(Nov 04 2019 at 19:26)</a>:</h4>
<p>and we do operations in them</p>



<a name="179865985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865985">(Nov 04 2019 at 19:26)</a>:</h4>
<p>but we never try to return data <em>out</em> of them</p>



<a name="179865993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179865993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179865993">(Nov 04 2019 at 19:26)</a>:</h4>
<blockquote>
<p>You say "equal" a higher-ranked region, but isn't it like nesting scopes?</p>
</blockquote>
<p>to circle back to this...</p>



<a name="179866054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866054">(Nov 04 2019 at 19:27)</a>:</h4>
<p>the idea of unvierses then is pretty simple, basically you have a counter that tracks the scopes you are in, and when you "enter" a <code>for&lt;'a&gt;</code> scope, you increment this counter -- that's called a new universe</p>



<a name="179866116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866116">(Nov 04 2019 at 19:27)</a>:</h4>
<p>it contains all the types from the previous univese, plus a placeholder</p>



<a name="179866137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866137">(Nov 04 2019 at 19:27)</a>:</h4>
<p>representing <code>'a</code></p>



<a name="179866312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866312">(Nov 04 2019 at 19:29)</a>:</h4>
<p>anyway I kind of feel like I'm re-covering stuff that I actually tried to write up in the rustc-guide, I'm trying to decide whihc points I want to emphasize...</p>



<a name="179866322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866322">(Nov 04 2019 at 19:29)</a>:</h4>
<p>...but if this is useful, I can kind of keep going :)</p>



<a name="179866534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866534">(Nov 04 2019 at 19:31)</a>:</h4>
<p>right, so in the new model, as you are going about, you sometimes enter a new scope -- this corresponds to kind of "entering" a forall. you are kind of tracking the innermost universe at this point in time</p>



<a name="179866668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866668">(Nov 04 2019 at 19:32)</a>:</h4>
<p>I'm trying to find where I wrote about this in the rustc-guid but I sort of can't :/</p>



<a name="179866683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866683">(Nov 04 2019 at 19:33)</a>:</h4>
<p>but I know I did somewhere...</p>



<a name="179866704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866704">(Nov 04 2019 at 19:33)</a>:</h4>
<p>ah yes, <a href="https://rust-lang.github.io/rustc-guide/borrow_check/region_inference/placeholders_and_universes.html" target="_blank" title="https://rust-lang.github.io/rustc-guide/borrow_check/region_inference/placeholders_and_universes.html">here is the chapter</a></p>



<a name="179866719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866719">(Nov 04 2019 at 19:33)</a>:</h4>
<p>the NLL checker in particular is based on this</p>



<a name="179866898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866898">(Nov 04 2019 at 19:34)</a>:</h4>
<p>sorry, my mind is elsewhere today :/ what I wanted to talk through a bit was the PR I've got open, and what I should do about it</p>



<a name="179866954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866954">(Nov 04 2019 at 19:35)</a>:</h4>
<p>let me back up  a bit</p>



<a name="179866981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179866981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179866981">(Nov 04 2019 at 19:35)</a>:</h4>
<p>I was going to ask, I knew we used universes in rustc somewhere.. does that mean we primarily use them in NLL but not in type checking?</p>



<a name="179867031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867031">(Nov 04 2019 at 19:35)</a>:</h4>
<p>yeah, currently we use them in NLL, but not in the type-checker</p>



<a name="179867074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867074">(Nov 04 2019 at 19:35)</a>:</h4>
<p>er, not in the older region system</p>



<a name="179867092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867092">(Nov 04 2019 at 19:35)</a>:</h4>
<p>this is not 100% true</p>



<a name="179867095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867095">(Nov 04 2019 at 19:35)</a>:</h4>
<p>we are kind of in a hybrid state</p>



<a name="179867132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867132">(Nov 04 2019 at 19:35)</a>:</h4>
<p>we are actally tracking universes *everywhere</p>



<a name="179867201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867201">(Nov 04 2019 at 19:36)</a>:</h4>
<p>but we are ALSO simulating the older system of handling higher-ranked types / trait-bounds</p>



<a name="179867205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867205">(Nov 04 2019 at 19:36)</a>:</h4>
<p>which is called the 'leak check'</p>



<a name="179867213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867213">(Nov 04 2019 at 19:36)</a>:</h4>
<p>maybe I should explain how <em>that</em> worked</p>



<a name="179867254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867254">(Nov 04 2019 at 19:36)</a>:</h4>
<p>the idea was: imagine you have</p>
<div class="codehilite"><pre><span></span>for&lt;&#39;a&gt; fn(&amp;&#39;a u32) = fn(?X)
</pre></div>



<a name="179867271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867271">(Nov 04 2019 at 19:37)</a>:</h4>
<p>this should <em>not</em> be true</p>



<a name="179867290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867290">(Nov 04 2019 at 19:37)</a>:</h4>
<p>after all, what can <code>?X</code> be such that it is true?</p>



<a name="179867309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867309">(Nov 04 2019 at 19:37)</a>:</h4>
<p>the problem here is exactly scoping</p>



<a name="179867319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867319">(Nov 04 2019 at 19:37)</a>:</h4>
<p>if you expand out that equation, you get something like</p>



<a name="179867345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867345">(Nov 04 2019 at 19:37)</a>:</h4>
<div class="codehilite"><pre><span></span>exists&lt;?X&gt; {
    for&lt;&#39;a&gt; fn(&amp;&#39;a u32) = fn(?X)
}
</pre></div>



<a name="179867442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867442">(Nov 04 2019 at 19:38)</a>:</h4>
<p>to put it in plain English, the <code>fn(?X)</code> type is "a function that takes some type <code>?X</code> as argument"</p>



<a name="179867459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867459">(Nov 04 2019 at 19:38)</a>:</h4>
<p>and the <code>for&lt;'a&gt; fn(&amp;'a u32)</code> is "a function that takes <code>&amp;'a u32</code> for <em>any</em> <code>'a</code> as argument"</p>



<a name="179867465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867465">(Nov 04 2019 at 19:38)</a>:</h4>
<p>so there is a scoping problem here</p>



<a name="179867473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867473">(Nov 04 2019 at 19:38)</a>:</h4>
<p>the way that we used to detect this</p>



<a name="179867487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867487">(Nov 04 2019 at 19:38)</a>:</h4>
<p>is basically we would push onto the stack (here I mean the literal program stack, in a sense)</p>



<a name="179867494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867494">(Nov 04 2019 at 19:38)</a>:</h4>
<p>effectively a new universe</p>



<a name="179867507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867507">(Nov 04 2019 at 19:38)</a>:</h4>
<p>then we would recurisvely process the type equality</p>



<a name="179867541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867541">(Nov 04 2019 at 19:39)</a>:</h4>
<p>so if that new universe is <code>U1</code>, then we would replcae <code>'a</code> with a placeholder region <code>!1</code> (let's say)</p>



<a name="179867553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867553">(Nov 04 2019 at 19:39)</a>:</h4>
<p>and we would try to equate <code>?X</code> with <code>&amp;'!1 u32</code></p>



<a name="179867626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867626">(Nov 04 2019 at 19:40)</a>:</h4>
<p>or I guess I made a more complicated example for myself</p>



<a name="179867645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867645">(Nov 04 2019 at 19:40)</a>:</h4>
<p>well, what this would do is replace <code>?X</code> with <code>&amp;'?x u32</code>, where <code>'?x</code> is an inference variable</p>



<a name="179867654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867654">(Nov 04 2019 at 19:40)</a>:</h4>
<p>so effectively you would get a constraint like <code>'?x = '!1</code></p>



<a name="179867667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867667">(Nov 04 2019 at 19:40)</a>:</h4>
<p>so far so ok, the way to think about this in universes is:</p>



<a name="179867722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867722">(Nov 04 2019 at 19:41)</a>:</h4>
<p>the <code>'!1</code> is in a universe 1 (say), but the <code>?x</code> is in universe 0, and hence it can't name <code>'!1</code>, so you have an error</p>



<a name="179867726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867726">(Nov 04 2019 at 19:41)</a>:</h4>
<p>the question is more when this is detected</p>



<a name="179867733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867733">(Nov 04 2019 at 19:41)</a>:</h4>
<p>the non-nll code is doing this thing called the leak-check</p>



<a name="179867800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867800">(Nov 04 2019 at 19:42)</a>:</h4>
<p>basically <em>during unification</em> we check whether <code>'!1</code> "leaks out" into any variables that can't name it</p>



<a name="179867833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867833">(Nov 04 2019 at 19:42)</a>:</h4>
<p>hi folks, around now</p>



<a name="179867839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867839">(Nov 04 2019 at 19:42)</a>:</h4>
<p>so we get an error</p>



<a name="179867865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867865">(Nov 04 2019 at 19:42)</a>:</h4>
<p>during the actual subtyping check</p>



<a name="179867914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867914">(Nov 04 2019 at 19:43)</a>:</h4>
<p>but this is different from how we handle regions most of the time</p>



<a name="179867922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867922">(Nov 04 2019 at 19:43)</a>:</h4>
<p>it's also a bit too strong</p>



<a name="179867931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867931">(Nov 04 2019 at 19:43)</a>:</h4>
<blockquote>
<p>but this is different from how we handle regions most of the time</p>
</blockquote>
<p>normally, the subtyping check just generates constraints that feed into region inference later</p>



<a name="179867968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179867968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179867968">(Nov 04 2019 at 19:44)</a>:</h4>
<p>I guess I can explain that a bit too</p>



<a name="179868083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868083">(Nov 04 2019 at 19:45)</a>:</h4>
<p>currently when we do operations on types we divide into two phases: the first check compares the "skelton" of the type and generates "region constraints", and then the second phase processes those constraints (region inference)</p>



<a name="179868141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868141">(Nov 04 2019 at 19:45)</a>:</h4>
<p>so e.g. if you have <code>&amp;'0 u32 &lt;: &amp;'1 u32</code>, where <code>'0</code> and <code>'1</code> are some regions, that would succeed, but generate a constraint <code>'0: '1</code> -- meaning that we have to prove later that <code>'0</code> outlives <code>'1</code></p>



<a name="179868220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868220">(Nov 04 2019 at 19:46)</a>:</h4>
<p>this distinction is kind of important</p>



<a name="179868238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868238">(Nov 04 2019 at 19:46)</a>:</h4>
<p>because there are some parts of the compiler (e.g., coercions, coherence) that ignore those region constraints when deciding how to handle your program</p>



<a name="179868397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868397">(Nov 04 2019 at 19:48)</a>:</h4>
<p>BTW don't want to interrupt your current discussion, but ping me when you're okay to move onto trait upcasting briefly :-)</p>



<a name="179868399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868399">(Nov 04 2019 at 19:48)</a>:</h4>
<p>ok, I will stop here and see if any of this is making sense so far</p>



<a name="179868813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868813">(Nov 04 2019 at 19:52)</a>:</h4>
<p>..so it sounds like you'd like to move the "leak check" out of the first phase (unification) and into the second (region inference)?</p>



<a name="179868825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868825">(Nov 04 2019 at 19:52)</a>:</h4>
<p>yes, more or less</p>



<a name="179868832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868832">(Nov 04 2019 at 19:52)</a>:</h4>
<p>and that's what my PR does</p>



<a name="179868845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868845">(Nov 04 2019 at 19:53)</a>:</h4>
<p>the problem with doing it in the first phase is two-fold</p>



<a name="179868847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868847">(Nov 04 2019 at 19:53)</a>:</h4>
<p>one, it's kind of surprising</p>



<a name="179868858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868858">(Nov 04 2019 at 19:53)</a>:</h4>
<p>in some cases</p>



<a name="179868881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868881">(Nov 04 2019 at 19:53)</a>:</h4>
<p>but more importantly, it assumes you have the full set of constraints available to you, so you can do the leak-check</p>



<a name="179868919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868919">(Nov 04 2019 at 19:53)</a>:</h4>
<p>basically what the code does is to walk the constraints that are propagating <em>back</em>, looking for constraints from a placeholder in some universe to a region that can't see that placeholder</p>



<a name="179868975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179868975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179868975">(Nov 04 2019 at 19:54)</a>:</h4>
<p>it is <em>also</em> true that this code is too strong and gives the wrong result</p>



<a name="179869011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869011">(Nov 04 2019 at 19:54)</a>:</h4>
<blockquote>
<p>so effectively you would get a constraint like <code>'?x = '!1</code></p>
</blockquote>
<p>so in my earlier example I mentioned this --</p>



<a name="179869023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869023">(Nov 04 2019 at 19:54)</a>:</h4>
<p>really this would be represented as two constraints</p>



<a name="179869051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869051">(Nov 04 2019 at 19:55)</a>:</h4>
<div class="codehilite"><pre><span></span>&#39;!1: &#39;?x
&#39;?x: &#39;!1
</pre></div>



<a name="179869075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869075">(Nov 04 2019 at 19:55)</a>:</h4>
<p>since if <code>'a: 'b</code> and <code>'b: 'a</code> then <code>'a = 'b</code></p>



<a name="179869098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869098">(Nov 04 2019 at 19:55)</a>:</h4>
<p>anyway so we would error out on those, because <code>?X</code> is from an outer universe</p>



<a name="179869112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869112">(Nov 04 2019 at 19:55)</a>:</h4>
<p>but you can have examples like</p>
<div class="codehilite"><pre><span></span>&#39;static: &#39;!1
</pre></div>


<p>and this should not error</p>



<a name="179869184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869184">(Nov 04 2019 at 19:56)</a>:</h4>
<p>but the <code>'static</code> may not always be visible</p>



<a name="179869209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869209">(Nov 04 2019 at 19:56)</a>:</h4>
<p>e.g. what if we had <code>'?x: '!1</code>, and <code>?x</code> were later inferred to be equal to <code>'static</code>?</p>



<a name="179869222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869222">(Nov 04 2019 at 19:56)</a>:</h4>
<p>right now, the leak-check rejects the constraint as unsatisfiable, but that's wrong</p>



<a name="179869232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869232">(Nov 04 2019 at 19:56)</a>:</h4>
<p>so the PR handles this in a more principled way</p>



<a name="179869242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869242">(Nov 04 2019 at 19:56)</a>:</h4>
<p>but this does have some effects on rust code</p>



<a name="179869271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869271">(Nov 04 2019 at 19:57)</a>:</h4>
<p>the biggest one has to do w/ coherence</p>



<a name="179869291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869291">(Nov 04 2019 at 19:57)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="k">fn</span><span class="p">(</span><span class="o">&amp;</span><span class="kt">u8</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="k">fn</span><span class="p">(</span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u8</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="179869304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869304">(Nov 04 2019 at 19:57)</a>:</h4>
<p>these two impls were previously permitted, but on the current branch, they are rejected</p>



<a name="179869384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869384">(Nov 04 2019 at 19:58)</a>:</h4>
<p>this falls out from coherence ignoring region constraints -- and the logic that causes them to get rejected has moved into the "solve the region constraints" part of the code</p>



<a name="179869494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869494">(Nov 04 2019 at 19:58)</a>:</h4>
<p>I'm not 100% sure if we can "get away" with this change -- it doesn't <em>seem</em> to affect many crates on crater, but we probably need a fresh crater run, and anyway we can't see all the crates.</p>



<a name="179869551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869551">(Nov 04 2019 at 19:58)</a>:</h4>
<p>I think though that we could restore the older behavior  if needed by modifying coherence</p>



<a name="179869576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869576">(Nov 04 2019 at 19:59)</a>:</h4>
<p>That said, there are reasons to prefer the newer behavior</p>



<a name="179869919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869919">(Nov 04 2019 at 20:00)</a>:</h4>
<p>ok, I think I'm going to leave this dissertation here for the moment. I'd encourage people to check out <a href="https://rust-lang.github.io/rustc-guide/borrow_check/region_inference/placeholders_and_universes.html" target="_blank" title="https://rust-lang.github.io/rustc-guide/borrow_check/region_inference/placeholders_and_universes.html">the rustc-guide chapter</a> -- I think it's a more organized presentation than the one I gave here. In any case, I didn't get to the tricky bits I had hope to talk about, but maybe I'll do some investigation and we can discuss next time.</p>



<a name="179869931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179869931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179869931">(Nov 04 2019 at 20:00)</a>:</h4>
<p>(also feel free to ask me questions)</p>



<a name="179870011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179870011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179870011">(Nov 04 2019 at 20:01)</a>:</h4>
<blockquote>
<p>so the PR handles this in a more principled way</p>
</blockquote>
<p>This is already implemented, right? The PR removes the leak check and which allows the universe based check to produce errors.</p>



<a name="179871411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/design%20meeting%202019.11.04/near/179871411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/design.20meeting.202019.2E11.2E04.html#179871411">(Nov 04 2019 at 20:13)</a>:</h4>
<p>yep</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>